package org.csu.mypetstoreplus.persistence;

import org.csu.mypetstoreplus.entity.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ProductDao extends JpaRepository<Product, Integer> {
    @Query(value = "select * from product where category =?1", nativeQuery = true)
    List<Product> findByCategoryId(String categoryId);

    @Query(value = "select * from product where productid =?1 limit 1", nativeQuery = true)
    Product findByProductId(String productId);
}
